package hashSet.book;

/**
 * 键盘输入n本书,按照价格从低到高排序后输出,如果价格相同则按照书名的自然顺序排序;
 *
 * **要求:**
 *
 * 1:书以对象形式存在,包含书名和价格(int类型)两个属性;
 *
 * 2:要求即使直接打印书对象的时候,也能看到书的名称和价格,而不是书对象的地址值;
 *
 * 3:分别使用自然排序和比较器排序实现效果;
 */

public class Book{
    private String bookName;
    private int price;

    public Book() {
    }

    public Book(String bookName, int price) {
        this.bookName = bookName;
        this.price = price;
    }

    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    @Override
    public String toString() {
        return "Book{" +
                "bookName='" + bookName + '\'' +
                ", price=" + price +
                '}';
    }
}
